# current dev version
if (! requireNamespace ("globaltrends" ))
devtools:: install_github ("ha-pu/globaltrends" , build_vignettes = TRUE )
Loading required namespace: globaltrends
# packages ----
library (dplyr)
Attaching package: 'dplyr'
The following objects are masked from 'package:stats':
filter, lag
The following objects are masked from 'package:base':
intersect, setdiff, setequal, union
library (globaltrends)
# connect to db ----
if (! file.exists ("db/globaltrends_db.sqlite" ))
initialize_db ()
start_db ()
Successfully connected to database.
Successfully exported all objects to package environment gt.env.
# add new control batch ----
new_control <- add_control_keyword (
keyword = c ("gmail" , "map" , "translate" , "wikipedia" , "youtube" ))
Successfully created new control batch 3 (gmail, map, translate, wikipedia, youtube, 2010-01-01 2020-12-31).
# add new object batch ----
new_object <- add_object_keyword (keyword = c ("manchester united" , "real madrid" ))
Successfully created new object batch 3 (manchester united, real madrid, 2010-01-01 2020-12-31).
if (FALSE ){
# run control download ----
download_control (control = new_control)
download_control_global (control = new_control)
# run object download ----
download_object (object = new_object)
download_object_global (object = new_object)
}
# compute search score ----
compute_score (
control = new_control,
object = new_object)
Successfully computed search score | control: 3 | object: 3 | location: AE [1/71]
Successfully computed search score | control: 3 | object: 3 | location: AO [2/71]
Successfully computed search score | control: 3 | object: 3 | location: AR [3/71]
Successfully computed search score | control: 3 | object: 3 | location: AT [4/71]
Successfully computed search score | control: 3 | object: 3 | location: AU [5/71]
Successfully computed search score | control: 3 | object: 3 | location: BD [6/71]
Successfully computed search score | control: 3 | object: 3 | location: BE [7/71]
Successfully computed search score | control: 3 | object: 3 | location: BR [8/71]
Successfully computed search score | control: 3 | object: 3 | location: CA [9/71]
Successfully computed search score | control: 3 | object: 3 | location: CH [10/71]
Successfully computed search score | control: 3 | object: 3 | location: CL [11/71]
Successfully computed search score | control: 3 | object: 3 | location: CN [12/71]
Successfully computed search score | control: 3 | object: 3 | location: CO [13/71]
Successfully computed search score | control: 3 | object: 3 | location: CU [14/71]
Successfully computed search score | control: 3 | object: 3 | location: CZ [15/71]
Successfully computed search score | control: 3 | object: 3 | location: DE [16/71]
Successfully computed search score | control: 3 | object: 3 | location: DK [17/71]
Successfully computed search score | control: 3 | object: 3 | location: DO [18/71]
Successfully computed search score | control: 3 | object: 3 | location: DZ [19/71]
Successfully computed search score | control: 3 | object: 3 | location: EC [20/71]
Successfully computed search score | control: 3 | object: 3 | location: EG [21/71]
Successfully computed search score | control: 3 | object: 3 | location: ES [22/71]
Successfully computed search score | control: 3 | object: 3 | location: ET [23/71]
Successfully computed search score | control: 3 | object: 3 | location: FI [24/71]
Successfully computed search score | control: 3 | object: 3 | location: FR [25/71]
Successfully computed search score | control: 3 | object: 3 | location: GB [26/71]
Successfully computed search score | control: 3 | object: 3 | location: GR [27/71]
Successfully computed search score | control: 3 | object: 3 | location: HK [28/71]
Successfully computed search score | control: 3 | object: 3 | location: HU [29/71]
Successfully computed search score | control: 3 | object: 3 | location: ID [30/71]
Successfully computed search score | control: 3 | object: 3 | location: IE [31/71]
Successfully computed search score | control: 3 | object: 3 | location: IL [32/71]
Successfully computed search score | control: 3 | object: 3 | location: IN [33/71]
Successfully computed search score | control: 3 | object: 3 | location: IQ [34/71]
Successfully computed search score | control: 3 | object: 3 | location: IR [35/71]
Successfully computed search score | control: 3 | object: 3 | location: IT [36/71]
Successfully computed search score | control: 3 | object: 3 | location: JP [37/71]
Successfully computed search score | control: 3 | object: 3 | location: KR [38/71]
Successfully computed search score | control: 3 | object: 3 | location: KW [39/71]
Successfully computed search score | control: 3 | object: 3 | location: KZ [40/71]
Successfully computed search score | control: 3 | object: 3 | location: LK [41/71]
Successfully computed search score | control: 3 | object: 3 | location: MA [42/71]
Successfully computed search score | control: 3 | object: 3 | location: MX [43/71]
Successfully computed search score | control: 3 | object: 3 | location: MY [44/71]
Successfully computed search score | control: 3 | object: 3 | location: NG [45/71]
Successfully computed search score | control: 3 | object: 3 | location: NL [46/71]
Successfully computed search score | control: 3 | object: 3 | location: NO [47/71]
Successfully computed search score | control: 3 | object: 3 | location: NZ [48/71]
Successfully computed search score | control: 3 | object: 3 | location: OM [49/71]
Successfully computed search score | control: 3 | object: 3 | location: PE [50/71]
Successfully computed search score | control: 3 | object: 3 | location: PH [51/71]
Successfully computed search score | control: 3 | object: 3 | location: PK [52/71]
Successfully computed search score | control: 3 | object: 3 | location: PL [53/71]
Successfully computed search score | control: 3 | object: 3 | location: PR [54/71]
Successfully computed search score | control: 3 | object: 3 | location: PT [55/71]
Successfully computed search score | control: 3 | object: 3 | location: QA [56/71]
Successfully computed search score | control: 3 | object: 3 | location: RO [57/71]
Successfully computed search score | control: 3 | object: 3 | location: RU [58/71]
Successfully computed search score | control: 3 | object: 3 | location: SA [59/71]
Successfully computed search score | control: 3 | object: 3 | location: SD [60/71]
Successfully computed search score | control: 3 | object: 3 | location: SE [61/71]
Successfully computed search score | control: 3 | object: 3 | location: SG [62/71]
Successfully computed search score | control: 3 | object: 3 | location: SK [63/71]
Successfully computed search score | control: 3 | object: 3 | location: TH [64/71]
Successfully computed search score | control: 3 | object: 3 | location: TR [65/71]
Successfully computed search score | control: 3 | object: 3 | location: TW [66/71]
Successfully computed search score | control: 3 | object: 3 | location: UA [67/71]
Successfully computed search score | control: 3 | object: 3 | location: US [68/71]
Successfully computed search score | control: 3 | object: 3 | location: UZ [69/71]
Successfully computed search score | control: 3 | object: 3 | location: VN [70/71]
Successfully computed search score | control: 3 | object: 3 | location: ZA [71/71]
Warning: Specifying `multiple = "error"` was deprecated in dplyr 1.1.1.
ℹ Please use `relationship = "many-to-one"` instead.
ℹ The deprecated feature was likely used in the globaltrends package.
Please report the issue at <https://github.com/ha-pu/globaltrends/issues/>.
compute_voi (
control = new_control,
object = new_object)
Successfully computed search score | control: 3 | object: 3 | location: world [1/1]
# compute degree of internationalization ----
compute_doi (
control = new_control,
object = new_object)
Successfully computed DOI | control: 3 | object: 3 [3/3]
# export data ----
out_score <- export_score (keyword = "manchester united" )
out_voi <- export_voi (keyword = "manchester united" )
out_doi <- export_doi (type = "obs" , locations = "countries" )
# plot data ----
plot_bar (data = out_score)
plot_ts (data = out_score)
Warning in plot_ts.exp_score(data = out_score): The plot function is limited to 1 location.
You use 71 locations.
Only 'AE' is used.
`geom_smooth()` using method = 'loess' and formula = 'y ~ x'
plot_box (data = out_score)
Warning in plot_box.exp_score(data = out_score): The plot function is limited to 1 location.
You use 71 locations.
Only 'AE' is used.
`geom_smooth()` using method = 'loess' and formula = 'y ~ x'
`geom_smooth()` using method = 'loess' and formula = 'y ~ x'
plot_voi_doi (data_voi = out_voi, data_doi = out_doi)
`geom_smooth()` using method = 'loess' and formula = 'y ~ x'
# get abnormal internationalization ----
abnorm_score <- get_abnorm_hist (data = out_score)
plot_bar (data = abnorm_score)
plot_ts (data = abnorm_score)
Warning in plot_ts.abnorm_score(data = abnorm_score): The plot function is limited to 1 location.
You use 71 locations.
Only 'AE' is used.
plot_box (data = abnorm_score)
Warning in plot_box.abnorm_score(data = abnorm_score): The plot function is limited to 1 location.
You use 71 locations.
Only 'AE' is used.
abnorm_voi <- get_abnorm_hist (data = out_voi)
plot_ts (data = abnorm_voi)
plot_box (data = abnorm_voi)
abnorm_doi <- get_abnorm_hist (data = out_doi)
plot_ts (data = abnorm_doi)
Warning in plot_ts.abnorm_doi(data = abnorm_doi): The plot function is limited to 1 keyword.
You use 2 keywords.
Only 'manchester united' is used.
plot_box (data = abnorm_doi)
Warning in plot_box.abnorm_doi(data = abnorm_doi): The plot function is limited to 1 keyword.
You use 2 keywords.
Only 'manchester united' is used.
# disconnect from db ----
disconnect_db ()
Successfully disconnected.